home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / banging_the_metal / qdos / qdos4amiga2 / romsrc / sys / qdos2_asm < prev    next >
Text File  |  2000-01-03  |  16KB  |  771 lines

  1. */beginfile QDOS2_asm
  2. ; --------------------------------------------------------------
  3. ; QDOS2_asm - The QDOS kernel
  4. ;       - last modified 06/09/95
  5. ; QDOS-Amiga sources by Rainer Kowallik
  6. ;    ...latest changes by Mark J Swift
  7. ; --------------------------------------------------------------
  8.  
  9. ; --------------------------------------------------------------
  10. ; was serial input/output routines
  11. L00AC0:
  12.  
  13. ; --------------------------------------------------------------
  14. ;*/beginoverlay
  15. ;*/beginfilling
  16. NOP00C88:
  17.     DCB.w    ($C88-(NOP00C88-ORGN))/2,$4E71
  18. L00C88:
  19. ;*/endfilling
  20. */endoverlay
  21. ; --------------------------------------------------------------
  22. ;  PIPE Device driver
  23. ; --------------------------------------------------------------
  24. DRLST:
  25.     DC.L    L00D36-ORG0
  26.     DC.L    IO_SERQ-ORG0    ; I/O Routine
  27.     DC.L    PIPE_OPEn-ORG0    ; OPEN
  28.     DC.L    PIPE_CLOse-ORG0    ; CLOSE
  29. L00C98:
  30. PIPE_OPEn:
  31.     SUBQ.W    #2,A7        ;*/undomend SUBQ.L #2,A7
  32.     MOVEA.L    A7,A3
  33.     JSR    IO_NAME(PC)    ;*/undomodify BSR IO_NAME
  34.     BRA.S    L00D00        ; error
  35.     BRA.S    L00D00        ; error
  36.     BRA.S    L00CB2        ; success
  37.     DC.W    4
  38.     DC.B    'PIPE'
  39.     DC.W    1,$205F        ; 1 parameter, " _"
  40.                 ; necessary
  41.     DC.W    0        ; length parameter
  42. L00CB2:
  43.     MOVE.W    (A7),D1
  44.     BEQ.S    L00CD2
  45.     ADDI.W    #$31,D1
  46.     JSR    MM_ALCHP(PC)    ;*/undomodify BSR MM_ALCHP
  47.     BNE.S    L00D00
  48.     MOVE.W    (A7),D1        ;!!! word length    may cause
  49.                 ; errors !!!
  50.     ADDQ.W    #1,D1
  51.     LEA    $20(A0),A2    ; pointer to buffer
  52.     JSR    IO_QSET(PC)    ;*/undomodify BSR IO_QSET
  53.     MOVE.L    A2,$1C(A0)
  54.     BRA.S    L00CFE
  55. L00CD2:
  56.                 ;*/undoinsert SUB.L A2,A2
  57.     MOVEA.W    D3,A2        ;*/note d3 sign exten long
  58.     ADDA.L    A2,A2
  59.     ADDA.L    A2,A2
  60.     ADDA.L    $78(A6),A2    ; pointer to base of channel
  61.                 ; table
  62.     MOVEA.L    (A2),A2
  63. ; is it a pipe channel ?
  64. RLOC02    CMPI.L    #(DRLST-ORG0),4(A2) ;*/undomodify EXG D0,A0;
  65.                   ;LEA DRLST(PC),A0; EXG A0,D0
  66.                   ;CMP.L 4(A2),D0
  67.     BNE.S    L00D04        ; no -> continue searching
  68.     MOVE.L    A2,-(A7)
  69.     MOVEQ    #$20,D1
  70.     JSR    MM_ALCHP(PC)    ;*/undomodify BSR MM_ALCHP
  71.     MOVEA.L    (A7)+,A2
  72.     BNE.S    L00D00
  73.     LEA    $20(A2),A2    ; pointer to buffer
  74.     MOVE.L    A0,(A2)
  75.     MOVE.L    A2,$18(A0)
  76. L00CFE:
  77.     MOVEQ    #0,D0
  78. L00D00:
  79.     ADDQ.W    #2,A7        ;*/undomend ADDQ.L #2,A7
  80.     RTS
  81. L00D04:
  82.     MOVEQ    #-15,D0
  83.     ADDQ.W    #2,A7        ;*/undomend ADDQ.L #2,A7
  84.     RTS
  85. L00D0A:
  86. PIPE_CLOse:
  87.     TST.L    $18(A0)        ; is channel open ?
  88.     BNE.S    L00D1C
  89.     LEA    $20(A0),A2    ; pointer to buffer
  90.     TST.L    (A2)        ; file empty ?
  91. ;if so - close channel
  92.     beq.s    L00D32        ;*/undomodify BEQ MM_RECHP
  93.                 ;*/note would be quicker though
  94. ; --------------------------------------------------------------
  95. ;*/beginoverlay
  96.     JMP    IO_QEOF(PC)    ;*/undomodify BRA IO_QEOF
  97.                 ;*/note routine has moved
  98. ;*/endoverlay
  99. ; --------------------------------------------------------------
  100. L00D1C:
  101.     MOVE.L    $18(A0),-(A7)
  102. ;close channel
  103.     bsr.s    L00D32        ;*/undomodify  BSR MM_RECHP
  104.                 ;*/note would be quicker though
  105.     MOVEA.L    (A7)+,A2
  106.     LEA    -$20(A2),A0
  107.     TST.B    (A2)        ; file empty ?
  108. ;if so - close channel
  109.     blt.s    L00D32        ;*/undomodify BLT MM_RECHP
  110.                 ;*/note would be quicker though
  111.     CLR.L    (A2)
  112.     MOVEQ    #0,D0
  113.     RTS
  114. ;*/beginrestorecode
  115. L00D32:
  116.     JMP    MM_RECHP(PC)    ;*/undomodify bra MM_RECHP
  117. ;*/endrestorecode
  118. ; *******************************************************
  119. ; * CONsole and SCReen device driver          *
  120. ; *******************************************************
  121. ; --------------------------------------------------------------
  122. ;*/beginoverlay
  123. L00D36:
  124.     DC.L    0        ;*/modify DC.L L01104-ORG0
  125.                 ;*/note now last in list
  126. ;*/endoverlay
  127. ; --------------------------------------------------------------
  128.     DC.L    CON_IN_Out-ORG0    ; I/O routine
  129.     DC.L    CON_OPEN-ORG0    ; OPEN
  130.     DC.L    CON_CLOSe-ORG0    ; CLOSE
  131. L00D46:
  132. CON_OPEN:
  133.     SUBA.W    #$A,A7        ;*/undomend SUBA.L
  134.                 ;*/note #$A sign extended long
  135.     MOVEA.L    A7,A3
  136.     JSR    IO_NAME(PC)    ;*/undomodify BSR IO_NAME
  137.     BRA.S    L00D9E        ; error    , try SCR
  138.     BRA.S    L00DC8        ; error
  139.     BRA.S    L00D72        ; success
  140.     DC.W    3
  141.     DC.B    'CON',0
  142.     DC.W    5,' _'        ; 5 parameters, needs " _"
  143.     DC.W    $1C0,' X'    ; width needs " X"
  144.     DC.W    $B4,' A'     ; hight needs " A"
  145.     DC.W    $20,' X'     ; x-origin needs " X"
  146.     DC.W    $10,' _'     ; y-origin needs " _"
  147.     DC.W    $80        ; defaut buffer: 128 bytes
  148. L00D72:
  149.     MOVEQ    #$7A,D1        ; initialize
  150.     ADD.W    8(A7),D1
  151.     BSR.S    L00DCE        ; open
  152.     BNE.S    L00DC8        ; out of memory
  153.     LEA    $68(A0),A2    ; initialize keyboard buffer
  154.     SUBI.W    #$78,D1
  155.     JSR    IO_QSET(PC)    ;*/undomodify BSR IO_QSET
  156.     MOVEA.L    $4C(A6),A3    ; pointer to keyboard queue
  157.     MOVE.L    A3,D3
  158.     BNE.S    L00D98        ; if buffer exists: create
  159.                 ; new one
  160.     MOVE.L    A2,(A2)
  161.     MOVE.L    A2,$4C(A6)    ; Pointer to keyboard queue
  162.     BRA.S    L00DC6
  163. L00D98:
  164.     MOVE.L    (A3),(A2)    ; link buffer-address
  165.     MOVE.L    A2,(A3)
  166.     BRA.S    L00DC6        ; back without error
  167. L00D9E:
  168.     JSR    IO_NAME(PC)    ;*/undomodify BSR IO_NAME
  169.     BRA.S    L00DC8        ; error
  170.     BRA.S    L00DC8        ; error
  171.     BRA.S    L00DC0        ; success
  172.     DC.W    3
  173.     DC.B    'SCR',0
  174.     DC.W    4,' _',$01C0,' X',$00B4,' A',$0020,' X',$0010
  175. L00DC0:
  176.     MOVEQ    #$6C,D1        ; length of description
  177.     BSR.S    L00DCE        ; open channel
  178.     BRA.S    L00DC8
  179. L00DC6:
  180.     MOVEQ    #0,D0
  181. L00DC8:
  182.     ADDA.W    #$0A,A7        ;*/undomend ADDA.L
  183.                 ;*/note #$0A sign extended long
  184.     RTS
  185. L00DCE:
  186.     JSR    MM_ALCHP(PC)    ;*/undomodify BSR MM_ALCHP
  187.     BNE.S    L00E38
  188.     MOVE.W    D1,-(A7)
  189.     LEA    $26(A0),A2
  190.     MOVE.L    #$06000A,(A2)+    ; character size / cursor
  191.                 ; increment
  192. RLOC03    MOVE.L    #(FONT1-ORG0),(A2)+ ; Character fount 0-127
  193.     MOVE.L    #(FONT2-ORG0),(A2)+ ; Character fount 128-256
  194.     bsr    CONFIX        ;*/modify  MOVE.L   #$20000,(A2)+
  195.     nop            ;*/modify
  196.     MOVE.W    #$80,$64(A0)    ; length of buffer ?
  197.     LEA    $3E(A0),A1
  198.     MOVEQ    #4,D1
  199.     MOVE.B    D1,$46(A0)    ; ink colour
  200.     JSR    L027D8(PC)    ;*/undomodify BSR L027D8
  201.     MOVE.L    #$08076400,$56(A0) ; 100.0 = graphics scale
  202.                  ; factor
  203.     bsr.l    MDTSTFIX     ;*/modify BTST     #3,$34(A6)
  204.     nop            ;*/modify
  205.     BEQ.S    L00E20
  206.     ADDQ.W    #6,$26(A0)    ; SD.XINC cursor increment
  207.     BSET    #6,$42(A0)    ; character attributes =
  208.                 ; double width
  209. L00E20:
  210.     MOVEQ    #0,D2
  211.     LEA    6(A7),A1
  212.     JSR    SD_WDEF(PC)    ;*/undomodify BSR SD_WDEF
  213.     MOVE.W    (A7)+,D1
  214.     TST.L    D0        ; error ?
  215.     BEQ.S    L00E38
  216.     MOVE.L    D0,-(A7)
  217.     JSR    MM_RECHP(PC)    ;*/undomodify BSR MM_RECHP
  218.     MOVE.L    (A7)+,D0     ; report
  219. L00E38:
  220.     RTS
  221. ; Console close
  222. L00E3A:
  223. CON_CLOSe:
  224.     LEA    $68(A0),A3    ; Input queue
  225.     TST.L    (A3)
  226.     BEQ.S    L00E70
  227.     MOVEA.L    (A3),A2
  228.     CMPA.L    A2,A3
  229.     BNE.S    L00E4E
  230.     CLR.L    $4C(A6)        ;SV.KEYQ Pointer to a
  231.                 ; keyboard queue
  232.     BRA.S    L00E70
  233. L00E4E:
  234.     CMPA.L    $4C(A6),A3    ;SV.KEYQ    Pointer to a
  235.                 ; keyboard queue
  236.     BNE.S    L00E66
  237. L00E54:
  238.     TST.B    (SD_CURF-$68)(A2)
  239.     BNE.S    L00E62
  240.     CMPA.L    (A2),A3
  241.     BEQ.S    L00E62
  242.     MOVEA.L    (A2),A2
  243.     BRA.S    L00E54
  244. L00E62:
  245.     MOVE.L    A2,$4C(A6)    ;SV.KEYQ    Pointer to a
  246.                 ; keyboard queue
  247. L00E66:
  248.     MOVEA.L    A3,A2
  249. L00E68:
  250.     MOVEA.L    (A2),A2
  251.     CMPA.L    (A2),A3
  252.     BNE.S    L00E68
  253.     MOVE.L    (A3),(A2)
  254. L00E70:
  255.     JSR    MM_RECHP(PC)    ;*/undomodify BRA MM_RECHP
  256.     RTS            ;*/undomodify nop
  257. ; CONsole I/O
  258. L00E76:
  259. CON_IN_Out:
  260.     TST.B    $33(A6)        ; screen status (freeze ?)
  261.     BEQ.S    L00E80        ; call TRAP3_UP
  262.     MOVEQ    #-1,D0        ; not complete
  263.     RTS
  264. ; This is called by the CON_ and SCR_ device driver
  265. L00E80:
  266.     CMPI.B    #7,D0
  267.     BHI.S    L00EFC        ;*/undomodify BHI TRAP3_UP
  268.                 ;*/note would be quicker though
  269.     MOVEQ    #-1,D7
  270.     MOVEQ    #0,D6
  271.     MOVE.W    D2,D5
  272.     MOVE.L    D1,D4
  273.     MOVEA.L    A1,A4
  274.     LEA    $68(A0),A5
  275.     TST.L    D3
  276.     BLT.S    L00EB0
  277.     CMPI.B    #$04,D0
  278.     BHI.S    L00EB0
  279.     TST.L    (A5)
  280.     BEQ.S    L00EEC
  281.     MOVEA.L    $4C(A6),A2    ; pointer to keyboard queue
  282.     TST.B    -$25(A2)
  283.     BNE.S    L00EB0
  284.     MOVE.L    A5,$4C(A6)    ; pointer to keyboard queue
  285. L00EB0:
  286.     MOVE.B    L00EB8(PC,D0.W),D0
  287.     JMP    L00EB8(PC,D0.W)
  288. L00EB8:
  289.     DC.B    L00EC0-L00EB8    ; test pending input
  290.     DC.B    L00EC4-L00EB8    ; put byte
  291.     DC.B    L00F54-L00EB8
  292.     DC.B    L00ECA-L00EB8    ; edit line
  293.     DC.B    L00F5A-L00EB8
  294.     DC.B    L00F00-L00EB8
  295.     DC.B    L00EEC-L00EB8    ; not used
  296.     DC.B    L00EDE-L00EB8    ; put in queue
  297. ; ----------------------------------------------------
  298. ;           General scr I/O
  299. ; ----------------------------------------------------
  300. L00EC0:
  301.     JMP    IO_QTEST(PC)    ;*/undomodify BRA IO_QTEST
  302. L00EC4:
  303.     MOVEA.L    A5,A2        ; A2=buffer address of
  304.                 ; keyboard
  305.     JMP    IO_QOUT(PC)    ;*/undomodify BRA IO_QOUT
  306. L00ECA:
  307.     MOVEQ    #0,D0
  308. L00ECC:
  309.     CMP.W    D4,D5        ; all chars printed
  310.     BLS.S    L00EEE
  311.     MOVEA.L    A5,A2
  312.     JSR    IO_QOUT(PC)    ;*/undomodify BSR IO_QOUT
  313.     BLT.S    L00EEE
  314.     MOVE.B    D1,(A4)+
  315.     ADDQ.W    #1,D4
  316.     BRA.S    L00ECC
  317. L00EDE:
  318.     MOVEQ    #0,D0
  319.     CMP.W    D4,D5
  320.     BLS.S    L00EEE
  321.     MOVE.B    (A4)+,D1
  322.     BSR.S    L00F00
  323.     ADDQ.W    #1,D4
  324.     BRA.S    L00EDE
  325. L00EEC:
  326.     MOVEQ    #-$0F,D0
  327. L00EEE:
  328.     MOVE.W    D4,D1
  329.     MOVEA.L    A4,A1
  330.     BCLR    #$07,$42(A0)
  331.     RTS
  332. L00EFA:
  333.     MOVEQ    #5,D0        ; IO.SBYTE
  334. L00EFC:
  335.     JMP    TRAP3_UP(PC)    ;*/undomodify BRA TRAP3_UP
  336. L00F00:
  337.     MOVEQ    #0,D0
  338.     CMPI.B    #$0A,D1        ; Line Feed ?
  339.     BEQ.S    L00F36        ; add new line
  340.     TST.B    $48(A0)        ; new line status
  341.     BEQ.S    L00F14        ; position cursor
  342.     MOVE.B    D1,-(A7)     ; byte to send on stack
  343.     BSR.S    L00F46        ; position cursor
  344.     MOVE.B    (A7)+,D1     ; ?????? REALLY ?
  345. L00F14:
  346.     BSR.S    L00EFA        ; put byte
  347.     BEQ.S    L00F44        ; succeeded -> end
  348.     MOVE.W    $26(A0),D0    ; if not: increment cursor
  349.     ADD.W    D0,$22(A0)
  350.     BTST    #$07,$42(A0)
  351.     BNE.S    L00F42
  352.     MOVE.B    D0,$48(A0)
  353.     TST.B    $43(A0)        ; cursor off ?
  354.     BEQ.S    L00F42        ; end
  355.     BSR.S    L00F46        ; position cursor
  356.     BRA.S    L00F42
  357. L00F36:
  358.     TST.B    $48(A0)        ; is cursor at end of line ?
  359.     BGE.S    L00F3E
  360.     BSR.S    L00F46        ; position cursor
  361. L00F3E:
  362.     ST    $48(A0)
  363. L00F42:
  364.     MOVEQ    #0,D0
  365. L00F44:
  366.     RTS
  367. ; position cursor
  368. L00F46:
  369.     TST.B    $43(A0)        ; new line - cursor activ ?
  370.     BLE.S    L00F50        ;  no
  371.     JSR    GET_CURPos(PC)    ;*/undomodify BSR GET_CURPos
  372.                 ; test position
  373. L00F50:
  374.     JMP    L01BF8(PC)    ;*/undomodify BRA L01BF8
  375.                 ; if necessary: LF
  376. L00F54:
  377.     TST.L    D3
  378.     BEQ.S    L00F6C
  379.     BRA.S    L00F5E
  380. ; line editor
  381. L00F5A:
  382.     MOVEQ    #-1,D4
  383.     MOVE.W    D1,D4
  384. L00F5E:
  385.     SWAP    D1
  386.     MOVE.W    D1,D6        ; position of cursor
  387.     SUBA.W    D4,A4        ; position cursor in buffer
  388.     ADDA.W    D6,A4
  389.     BNE.S    L00F84        ; end of buffer
  390.     TST.L    D3
  391.     BLT.S    L00F84
  392. L00F6C:
  393.     TST.B    $43(A0)        ; cursor on ?
  394.     BLE.S    L00F76
  395.     JSR    GET_CURPos(PC)    ;*/undomodify BSR GET_CURPos
  396.                 ; position cursor
  397. L00F76:
  398.     JSR    L01BF2(PC)    ;*/undomodify BSR L01BF2
  399.                 ; if neccessary to start
  400.     BSR    L010DC        ; of next line
  401.     MOVE.W    D4,D6
  402.     SUB.W    D3,D6
  403.     SUBA.W    D3,A4        ;!!! word length may cause
  404.                 ; errors !!!
  405. L00F84:
  406.     MOVE.B    $43(A0),-(A7)
  407. L00F88:
  408.     MOVEA.L    A5,A2        ; keyboard buffer
  409.     JSR    IO_QOUT(PC)    ;*/undomodify BSR IO_QOUT
  410.                 ; get byte
  411.     BLT    L01018        ; EOF ?
  412.     TST.B    $43(A0)        ; cursor activ
  413.     BLE.S    L00FA0
  414.     MOVE.B    D1,-(A7)     ; received byte
  415.     JSR    GET_CURPos(PC)    ;*/undomodify BSR GET_CURPos
  416.                 ; position cursor
  417.     MOVE.B    (A7)+,D1     ; ????
  418. L00FA0:
  419.     CMPI.B    #$0A,D1        ; Line Feed ?
  420.     BEQ.S    L01002
  421.     CMPI.B    #$1F,D1        ; not a valid character ->
  422.                 ; do nothing
  423.     BLS.S    L00F88
  424.     CMPI.B    #$BF,D1        ; >191 -> append chequer
  425.                 ; board
  426.     BHI.S    L00FDA
  427.     MOVE.W    D4,D0        ; length of line
  428.     SUB.W    D6,D0        ; actual position
  429.     BRA.S    L00FBE        ; store byte
  430. L00FB8:
  431.     MOVE.B    0(A4,D0.W),1(A4,D0.W) ; line out
  432. L00FBE:
  433.     DBF    D0,L00FB8
  434.     ADDQ.W    #1,D6
  435.     ADDQ.W    #1,D4        ; correct pointer
  436.     MOVE.B    D1,(A4)+     ; store byte
  437.     MOVEQ    #-1,D7
  438.     BSR    L010AC
  439.     BSR    L010CE        ; scroll ?
  440.     CMP.W    D4,D5
  441.     BHI.S    L00F88        ; more bytes editable
  442.     MOVEQ    #-5,D0        ; buffer full error
  443.     BRA.S    L01022
  444. L00FDA:
  445.     TST.L    D4
  446.     BGE.S    L00FEA
  447.     CMPI.B    #$D0,D1        ; cursor up
  448.     BEQ.S    L01002
  449.     CMPI.B    #$D8,D1        ; down
  450.     BEQ.S    L01002
  451. L00FEA:
  452.     SUBI.B    #$C0,D1        ; left
  453.     BEQ.S    L01030
  454.     SUBQ.B    #2,D1        ; ctrl. left = delete
  455.     BEQ    L0107C
  456.     SUBQ.B    #6,D1        ; right
  457.     BEQ.S    L01038
  458.     SUBQ.B    #2,D1        ; ctrl. right
  459.     BEQ    L01080
  460. L01000:
  461.     BRA.S    L00F88        ; position cursor
  462. L01002:
  463.     MOVE.B    D1,-(A7)     ; output of line - cursor
  464.                 ; up/down
  465.     MOVEQ    #-1,D7
  466.     BSR    L010E0
  467.     MOVE.B    (A7)+,(A4)+
  468.     ADDQ.W    #1,D4
  469.     JSR    SD_CURS(PC)    ;*/undomodify BSR SD_CURS
  470.     BSR    L00F36
  471.     BRA.S    L0102A
  472. L01018:
  473.     TST.B    (A7)        ; end of edit
  474.     BLT.S    L01022
  475.     JSR    SD_CURE(PC)    ;*/undomodify BSR SD_CURE
  476.     MOVEQ    #-1,D0
  477. L01022:
  478.     SUBA.W    D6,A4        ;!!! word  length may cause
  479.                 ; errors !!!
  480.     ADDA.W    D4,A4
  481.     MOVE.W    D6,D1
  482.     SWAP    D1
  483. L0102A:
  484.     ADDQ.W    #2,A7        ;*/undomend ADDQ.L #2,A7
  485.     BRA    L00EEE
  486. L01030:
  487.     BSR.S    L01054        ; cursor left previous line
  488.                 ; ?
  489.     BEQ.S    L01000        ; pos cursor
  490. L01034:
  491.     ADDQ.W    #1,D6
  492.     BRA.S    L01000
  493. L01038:
  494.     ADDQ.W    #1,D6        ; cursor right
  495.     CMP.W    D4,D6
  496.     BHI.S    L01050        ; end of buffer ?
  497.     ADDQ.W    #1,A4        ;*/undomend ADDQ.L #1,A4
  498.     JSR    SD_NCOL(PC)    ;*/undomodify BSR SD_NCOL
  499.     BEQ.S    L01000
  500.     JSR    L01BF8(PC)    ;*/undomodify BSR L01BF8
  501.     BSR    L010CE
  502.     BRA.S    L01000
  503. L01050:
  504.     SUBQ.W    #1,D6
  505. L01052:
  506.     BRA.S    L01000
  507. L01054:
  508.     SUBQ.W    #1,D6        ; previous line to edit
  509.     BLT.S    L0107A
  510.     JSR    SD_PCOL(PC)    ;*/undomodify BSR SD_PCOL
  511.     BEQ.S    L01078
  512.     JSR    SD_PROW(PC)    ;*/undomodify BSR SD_PROW
  513.     BNE.S    L010DA
  514.     MOVE.W    $1C(A0),D0
  515.     DIVU    $26(A0),D0
  516.     SUBQ.W    #1,D0
  517.     MULU    $26(A0),D0
  518.     MOVE.W    D0,$22(A0)
  519.     MOVEQ    #0,D0
  520. L01078:
  521.     SUBQ.W    #1,A4        ;*/undomend SUBQ.L #1,A4
  522. L0107A:
  523.     BRA.S    L010DA
  524. L0107C:
  525.     BSR.S    L01054        ; delete one character:
  526.                 ; ctrl. left/right
  527.     BNE.S    L01034
  528. L01080:
  529.     CMP.W    D6,D4
  530.     BEQ.S    L01052
  531.     SUBQ.W    #1,D4
  532.     MOVE.W    D4,D0
  533.     SUB.W    D6,D0
  534.     MOVE.W    D0,D1
  535.     BRA.S    L01092
  536. L0108E:
  537.     MOVE.B    $01(A4),(A4)+
  538. L01092:
  539.     DBF    D0,L0108E
  540.     SUBA.W    D1,A4        ;!!! word length may cause
  541.                 ; errors !!!
  542.     MOVE.L    $22(A0),-(A7)
  543.     MOVEQ    #0,D7
  544.     BSR.S    L010E0
  545.     BNE.S    L010A6
  546.     MOVEQ    #$20,D1
  547.     BSR.S    L010AC
  548. L010A6:
  549.     MOVE.L    (A7)+,D7
  550.     BSR.S    L010D0
  551.     BRA.S    L01052
  552. L010AC:
  553.     BSR    L00EFA        ; position cursor
  554.     BEQ.S    L010DA
  555.     JSR    SD_NL(PC)    ;*/undomodify BSR SD_NL
  556.     BEQ.S    L010DA
  557.     TST.W    D7
  558.     BLT.S    L010C8
  559.     SUB.W    $28(A0),D7
  560.     BGE.S    L010C8
  561.     ADD.W    $28(A0),D7
  562.     BRA.S    L01100
  563. L010C8:
  564.     JSR    L01BF8(PC)    ;*/undomodify BSR L01BF8
  565.                 ; scroll if needed
  566.     BRA.S    L010D8
  567. L010CE:
  568.     BSR.S    L010DC
  569. L010D0:
  570.     SUBA.W    D4,A4        ;!!! word length may cause
  571.                 ; errors !!!
  572.     ADDA.W    D6,A4
  573.     MOVE.L    D7,$22(A0)
  574. L010D8:
  575.     MOVEQ    #0,D0
  576. L010DA:
  577.     RTS
  578. L010DC:
  579.     MOVE.L    $22(A0),D7
  580. L010E0:
  581.     MOVEQ    #0,D0
  582.     MOVE.W    D4,D3
  583.     SUB.W    D6,D3
  584.     BRA.S    L010F4
  585. L010E8:
  586.     MOVE.B    (A4)+,D1
  587.     MOVE.W    D3,-(A7)
  588.     BSR.S    L010AC
  589.     MOVE.W    (A7)+,D3
  590.     TST.L    D0
  591.     BNE.S    L010FC
  592. L010F4:
  593.     DBF    D3,L010E8
  594.     MOVEQ    #0,D3
  595.     RTS
  596. L010FC:
  597.     ADDA.W    D3,A4        ;!!! word length may cause
  598.                 ; errors !!!
  599.     ADDQ.W    #1,D3
  600. L01100:
  601.     TST.L    D0
  602.     RTS
  603. ; end of line editor
  604. ; --------------------------------------------------------------
  605. ;*/beginoverlay
  606. ; was network input/output routines
  607. L01104:
  608.  
  609. CONFIX:
  610.     move.l    #$20000,(a2)+    ; Base of screen
  611.     move.l    SV_JBPNT(a6),a1
  612.     move.l    (a1),a1
  613.     btst    #0,JB_RELA6(a1)
  614.     beq.s    CONFIX1
  615.  
  616.     cmp.l    #$30000,a6    ; if sys vars too low
  617.     blt.s    CONFIX1        ; then no 2nd screen.
  618.  
  619.     bset    #7,-2(a2)    ; second screen
  620.  
  621. CONFIX1:
  622.     rts
  623.  
  624. MODEFIX:
  625.     moveq    #0,d0
  626.     MOVE.B    SV_MCSTA(A6),D0    ; Current value of MC status
  627.                 ; register
  628.  
  629.     lsl.w    #1,d0        ; position correctly
  630.     lsl.b    #3,d0
  631.     lsr.w    #1,d0
  632.     asr.b    #3,d0
  633.  
  634.     andi.b    #%10011111,d0    ; keep relevant bits
  635.  
  636.     move.l    SV_JBPNT(a6),a4    ; current job
  637.     move.l    (a4),a4        ; JCB of job
  638.     btst    #0,JB_RELA6(a4)    ; test dflt scrn bit of JOBs' JB_RELA6
  639.     beq.s    MODEFIX1
  640.  
  641.     eori.b    #%10100000,d0
  642.  
  643. MODEFIX1:
  644.     tst.b    d0
  645.     bpl.s    MODEFIX2
  646.  
  647.     bsr    MODEFIX4
  648.  
  649. MODEFIX2:
  650.     bclr    #7,d0
  651.     cmp.l    #$30000,a6
  652.     blt.s    MODEFIX3
  653.  
  654.     ori.b    #%10000000,d0
  655.  
  656. MODEFIX3:
  657.     rts
  658.  
  659. MODEFIX4:
  660.     swap    d1
  661.     lsl.w    #4,d0
  662.     move.b    d0,d1
  663.     andi.b    #%10100000,d1
  664.     lsr.b    #2,d1
  665.     andi.b    #%01010000,d0
  666.     or.b    d1,d0
  667.     lsl.b    #1,d0
  668.     lsr.w    #4,d0
  669.     swap    d1
  670.     rts
  671.  
  672. CJOBFIX:
  673.     LEA    (JB_END-JB_PC)(A0),A0 ; start of program area
  674.     move.l    SV_JBPNT(a6),a4    ; current job
  675.     move.l    (a4),a4        ; JCB of job
  676.     move.b    JB_RELA6(a4),d0    ; get screen (lsb of JB_RELA6)
  677.     andi.b    #%00000001,d0
  678.     move.b    d0,(JB_RELA6-JB_END)(a0) ; inherit screen
  679.     rts
  680.  
  681. MDTSTFIX:
  682.     cmpi.l    #$28000,SD_SCRB(a0)
  683.     bne.s    MDTSTFIX1
  684.  
  685.     btst    #7,$34(a6)    ; is screen being shown?
  686.     beq.s    MDTSTFIX2    ; no, check other mode
  687.     bra.s    MDTSTFIX3    ; yup, check shown mode
  688.  
  689. MDTSTFIX1:
  690.     btst    #7,$34(a6)    ; is screen being shown?
  691.     beq.s    MDTSTFIX3    ; yup, check shown mode
  692.  
  693. MDTSTFIX2:
  694.     btst    #2,$34(a6)    ; 512 or 256 pixel mode ?
  695.     rts
  696.  
  697. MDTSTFIX3:
  698.     btst    #3,$34(a6)    ; 512 or 256 pixel mode ?
  699.     rts
  700.  
  701. MDCLS:
  702.  
  703. ; Clear scrn0 ?
  704.  
  705. MDCLS0:
  706.     btst.w    #15,d1
  707.     bne.s    MDCLS1
  708.  
  709.     lea    $28000,a4
  710.     move.w    #$1FFF,d0
  711.  
  712. MDCLSLUP0:
  713.     clr.l    -(a4)
  714.     DBF    D0,MDCLSLUP0
  715.  
  716. ; Clear scrn1 ?
  717.  
  718. MDCLS1:
  719.     btst.w    #14,d1
  720.     bne.s    MDCLSX
  721.  
  722.     lea    $30000,a4
  723.     move.w    #$1FFF,d0
  724.     cmp.l    a4,a6
  725.     blt.s    MDCLSX
  726.  
  727. MDCLSLUP1:
  728.     clr.l    -(a4)
  729.     DBF    D0,MDCLSLUP1
  730.  
  731. MDCLSX:
  732.     rts
  733.  
  734. ;*/beginfilling
  735. NOP01202:
  736.     DCB.w    ($1202-(NOP01202-ORGN))/2,$4E71
  737. L01202:
  738. ;*/endfilling
  739. ;*/endoverlay
  740. ; --------------------------------------------------------------
  741. ;  scheduler loop tasks (Cursor)
  742. ; --------------------------------------------------------------
  743. SHLST:
  744. ; --------------------------------------------------------------
  745. ;*/beginoverlay
  746.     DC.L    SHLST2-ORG0    ;*/modify DC.L SHLST1-ORG0
  747. ;*/endoverlay
  748. ; --------------------------------------------------------------
  749.     DC.L    CURSOR_Task-ORG0
  750. CURSOR_Task:
  751.     MOVE.L    $4C(A6),D4    ; Pointer to a keyboard
  752.                 ; queue
  753.     BEQ.S    L0122E
  754.     MOVEA.L    D4,A0
  755.     LEA    -$68(A0),A0
  756.     MOVE.W    $AA(A6),D4    ; flashing cursor status
  757.     TST.B    $43(A0)
  758.     BEQ.S    L01228
  759.     SUB.W    D3,D4
  760.     BGT.S    L0122A
  761.     JSR    GET_CURPos(PC)    ;*/undomodify BSR GET_CURPos
  762. L01228:
  763.     MOVEQ    #$0C,D4
  764. L0122A:
  765.     MOVE.W    D4,$AA(A6)    ; flashing cursor status
  766. L0122E:
  767.     RTS
  768. ; --------------------------------------------------------------
  769. ;*/endfile
  770.  
  771.